<?php
namespace Home\Controller;
use Think\Controller;
class PrizeController extends Controller {
	public function getIsPostRequest(){
        return isset($_SERVER['REQUEST_METHOD']) && !strcasecmp($_SERVER['REQUEST_METHOD'],'POST');
	}
    public function getAllPrize(){
         $prize=M('prize')
	   $data=prize->order('pId asc')->select();
	   echo json_encode($data);
    }
     public function getPrizeById(){
     	if(getIsPostRequest()){
        $pId=$_GET['pId'];
       }
       else{
       	$pId=$_POST['pId'];
       }
        $prize=M('prize');
        $data=prize->where("pId=$pId")->select();
        echo json_encode($data);
    }
}